package com.ad_hccm.config;

import com.ad_hccm.interceptor.JwtInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * TODO 拦截器配置，哪些需要拦截
 */
@Configuration
public class AuthWebMvcConfigurer implements WebMvcConfigurer {
    @Autowired
    HandlerInterceptor jwtInterceptor;//拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 除了/login都拦截
        registry.addInterceptor(jwtInterceptor).addPathPatterns("/**").excludePathPatterns("/login");
    }
}
